package com.cenjiawen.common;

public class Http {
	
//	private static final String URL = "url";
//	private static final String APP_KEY = "key";
//	private static final String SECRET_KEY = "secret";
//	HttpClientContext context = HttpClientContext.create();
//	
//	 private String getHeader() {
//	        String auth = APP_KEY + ":" + SECRET_KEY;
//	        byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("US-ASCII")));
//	        String authHeader = "Basic " + new String(encodedAuth);
//	        return authHeader;
//	    }
//
//	public void addUserOAuth(String username, String password) {
//        CredentialsProvider credsProvider = new BasicCredentialsProvider();
//        org.apache.http.auth.Credentials credentials = new org.apache.http.auth.UsernamePasswordCredentials(username, password);
//        credsProvider.setCredentials(org.apache.http.auth.AuthScope.ANY, credentials);
//        this.context.setCredentialsProvider(credsProvider);
//    }
//	
//	public void send() throws ClientProtocolException, IOException {
//		HttpClient httpClient = HttpClientBuilder.create().build();
//		HttpPost httpPost = BaseHttpPost.buildHttpHeader(url);
//		// 设置请求的参数
//		List<NameValuePair> nvps = new ArrayList<NameValuePair>();
//		nvps.add(new BasicNameValuePair("fromAccid", fromAccid));
//		nvps.add(new BasicNameValuePair("toAccids", toAccids));
//		nvps.add(new BasicNameValuePair("type", msgType));
//		Map<String, Object> body = new HashMap<String, Object>();
//		body.put("msg", msg);
//		nvps.add(new BasicNameValuePair("body", JSON.toJSONString(body)));
//		nvps.add(new BasicNameValuePair("pushcontent", msg));
//		httpPost.setEntity(new UrlEncodedFormEntity(nvps, "utf-8"));
//	}
}
